﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace KL.Store.Core.Domain
{
    #region Product

    public class Product
    {
        private bool _fastCargo;

        public int ProductId { get; set; }
        public string ProductCode { get; set; }
        public string ProductName { get; set; }
        public string ProductName2 { get; set; }
        public string ProductShortName { get; set; }
        public string Unit { get; set; }
        public string Currency { get; set; }
        public double Quantity { get; set; }
        public bool IsActive { get; set; }
        public decimal MarketPrice { get; set; }
        public decimal OldPrice { get; set; }
        public decimal Price { get; set; }
        public decimal SpecialPrice { get; set; }
        public decimal PriceWithOutTax { get; set; }
        public decimal SpecialPriceWithOutTax { get; set; }
        public decimal PriceWithTax { get; set; }
        public decimal CreditCardPrice { get; set; }
        public decimal CreditCardPriceWithoutTax { get; set; }
        public decimal MinimumPrice { get; set; }
        public decimal SupplierPrice { get; set; }
        public string Transport { get; set; }
        public decimal TransferPrice { get; set; }
        public decimal TransferPriceWithoutTax { get; set; }
        public decimal DiscountTotal { get; set; }
        public decimal DiscountPercent { get; set; }
        public decimal DiscountDisplayTotal { get; set; }
        public decimal DealerSellingPrice { get; set; }
        public decimal BuyingPrice { get; set; }
        public decimal InStock { get; set; }
        public decimal InStockDepo { get; set; }
        public decimal StockOnTheWay { get; set; }
        public bool CheckStock { get; set; }
        public decimal InShoppingChart { get; set; }
        public string LinkUrl { get; set; }
        public string UstLinkUrl { get; set; }
        public int RewardPoints { get; set; }
        public string Description { get; set; }
        public string Description2 { get; set; }
        public string Information { get; set; }
        public bool NewProduct { get; set; }
        public bool FastCargo
        {
            get
            {
                if (_fastCargo)
                {
                    return _fastCargo;
                }
                else
                {
                    if (InStockDepo >= Parameters.MinInStockAmountForFastCargo)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
            set { _fastCargo = value; }
        }
        public bool FreeCargo { get; set; }
        public bool OpportunityProduct { get; set; }
        public bool CampaignProduct { get; set; }
        public bool ShowAsCampaignProduct { get; set; }
        public decimal CargoPrice { get; set; }
        public decimal AddtCargoPrice { get; set; }
        public decimal CargoPriceWithTax { get; set; }
        public decimal CargoPriceField { get; set; }
        public decimal CargoPriceAddition { get; set; }
        public string DeliveryPeriod { get; set; }
        public string VarrantyPeriod { get; set; }
        public short DeliveryTime { get; set; }
        public short VarrantyTime { get; set; }
        public bool DeliveryNeeded { get; set; }
        public decimal TaxRate { get; set; }
        public string Brand { get; set; }
        public int BrandId { get; set; }
        public int CategoryId { get; set; }
        public string Category { get; set; }
        public int ParentCategoryId { get; set; }
        public string ParentCategory { get; set; }
        public string QuestionText { get; set; }
        public string CreatedDate { get; set; }
        public string ModifiedDate { get; set; }
        public int GGProductId { get; set; }
        public string GGCategoryCode { get; set; }
        public string GGSubTitle { get; set; }
        public bool GGBoldOption { get; set; }
        public string Model { get; set; }
        public decimal Width { get; set; }
        public decimal Length { get; set; }
        public decimal Height { get; set; }
        public decimal Desi { get; set; }
        public decimal Weight { get; set; }
        public bool InstallmentNeeded { get; set; }
        public decimal InstallmentPrice { get; set; }
        public bool FreeCargoInCity { get; set; }
        public bool FreeInstallmentInCity { get; set; }
        public bool ParentCategoryBannerActive { get; set; }
        public bool CategoryBannerActive { get; set; }
        public bool BrandBannerActive { get; set; }
        public decimal Price1 { get; set; }
        public decimal Price2 { get; set; }
        public decimal Price3 { get; set; }
        public string BuyingCurrency { get; set; }
        public decimal ExchangePrice { get; set; }
        public string ExchangeCurrency { get; set; }
        public string WebDescription { get; set; }
        public string WebTitle { get; set; }
        public string Barcode { get; set; }
        public int TotalViewCount { get; set; }
        public decimal BillOut { get; set; }
        public string ProductProperties { get; set; }
        public int ProductBrand { get; set; }
        public int xmlBrandId { get; set; }
        public int xmlGroupId { get; set; }
        public int ProductImageCount { get; set; }
        public int SiraNo { get; set; }
        public int UstUrunId { get; set; }
        public string GiftString { get; set; }
        public string SpecialText { get; set; }
        public string CanonicalLink { get; set; }
        public int SuggestedGroup { get; set; }
        public int MaxInstallmentCount { get; set; }
        public int VariantCount { get; set; }
        public string Variant1 { get; set; }
        public string Variant2 { get; set; }
        public string Variant3 { get; set; }
        public string XmlUpdate { get; set; }
        public string XmlId { get; set; }
        public bool ShowModelOnProductDetails { get; set; }
    }

    #endregion

    #region ProductProfitRate
    public class ProductProfitRate
    {
        public decimal BrandProfitRate { get; set; }
        public decimal GroupProfitRate { get; set; }
    }
    #endregion

    #region ProductInfo

    public class ProductInfo
    {
        public int SatirNo { get; set; }
        public string Type { get; set; }
        public string Information { get; set; }
    }

    #endregion

    #region Brand

    public class Brand
    {
        public int BrandId { get; set; }
        public string BrandName { get; set; }
        public int ItemCount { get; set; }
    }

    #endregion

    #region Property

    public class Property
    {
        public int IdGrup { get; set; }
        public int SatirNo { get; set; }
        public string Aciklama { get; set; }
        public bool estoregoster { get; set; }
        public int PropertyCount { get; set; }
    }

    #endregion

    #region PropertyList

    public class PropertyList
    {
        public int KartId { get; set; }
        public string Aciklama { get; set; }
        public string Bilgi { get; set; }
    }

    #endregion

    #region Brand-single

    //public class BrandSingle
    //{
    //    public string BrandList { get; set; }
    //}

    #endregion

    #region ProductMeta
    public class ProductMeta
    {
        public int ProductId { get; set; }
        public string ProductName { get; set; }
        public string Description { get; set; }
        public string Keywords { get; set; }
        public string WebTitle { get; set; }
        public string CanonicalLink { get; set; }
        public string Model { get; set; }
    }
    #endregion

    #region ProductLiveSearch

    public class ProductLiveSearch
    {
        public int ProductId { get; set; }
        public string ProductCode { get; set; }
        public string Barcode { get; set; }
        public string ProductName { get; set; }
        public string LinkUrl { get; set; }
        public string Brand { get; set; }
        public string Category { get; set; }
    }

    #endregion

    #region ProductImage

    public class ProductImage
    {
        public int ProductId { get; set; }
        public short ImageId { get; set; }
    }

    #endregion

    #region variantProperties

    public class variantProperties
    {
        public int id { get; set; }
        public int productId { get; set; }
        public int order { get; set; }
        public string value { get; set; }
        public int mainProductId { get; set; }
        public string LinkUrl { get; set; }
        public string ProductName { get; set; }
        public string Model { get; set; }
    }

    #endregion

    #region variantUrls

    public class variantUrls
    {
        public int ProductId { get; set; }
        public string ProductName { get; set; }
        public string Model { get; set; }
        public string LinkUrl { get; set; }
    }

    #endregion

    #region ProductGroup

    public class ProductGroup
    {
        public int GroupId { get; set; }
        public string GroupName { get; set; }
        public string GroupCode { get; set; }
        public int ColumnCount { get; set; }
        public string ListImageType { get; set; }
        public int ParentGroupId { get; set; }
        public string ParentGroupName { get; set; }
    }

    #endregion

    #region ProductGroups

    public class ProductGroups
    {
        public int ProductId { get; set; }
        public int CategoryId { get; set; }
        public string CategoryName { get; set; }
        public string GroupType { get; set; }
    }

    #endregion

    #region StockAmount

    public class StockAmount
    {
        public string _ambarName;
        public decimal _konsinyeKalan;
        public decimal _irsaliyeKalan;
        public decimal _faturaKalan;
        public decimal _stokKalan;
        public decimal _uretimKalan;
        public decimal _transferKalan;
        public decimal _siparisKalan;
        public decimal _rezerveKalan;
        public decimal _stokToplam;


        public int KartId { get; set; }
        public int AmbarId { get; set; }
        public string AmbarName
        {
            get
            {
                if (!string.IsNullOrEmpty(_ambarName))
                {
                    return _ambarName;
                }
                else
                {
                    var AmbarAdi = Parameters.AmbarList.Where(a => a.IdAmbar == AmbarId).FirstOrDefault().AmbarAdi;
                    return !string.IsNullOrEmpty(AmbarAdi) ? AmbarAdi : "";
                }
            }
            set { _ambarName = value; }
        }
        public decimal DevirGiris { get; set; }
        public decimal KonsinyeGiris { get; set; }
        public decimal KonsinyeCikis { get; set; }
        public decimal KonsinyeKalan
        {
            get
            {
                return _konsinyeKalan > 0 ? _konsinyeKalan : KonsinyeGiris - KonsinyeCikis;
            }
            set { _konsinyeKalan = value; }
        }
        public decimal IrsaliyeGiris { get; set; }
        public decimal IrsaliyeCikis { get; set; }
        public decimal IrsaliyeKalan
        {
            get
            {
                return _irsaliyeKalan > 0 ? _irsaliyeKalan : IrsaliyeGiris - IrsaliyeCikis;
            }
            set { _irsaliyeKalan = value; }
        }
        public decimal FaturaGiris { get; set; }
        public decimal FaturaCikis { get; set; }
        public decimal FaturaKalan
        {
            get
            {
                return _faturaKalan > 0 ? _faturaKalan : FaturaGiris - FaturaCikis;
            }
            set { _irsaliyeKalan = value; }
        }
        public decimal StokGiris { get; set; }
        public decimal StokCikis { get; set; }
        public decimal StokKalan
        {
            get
            {
                return _stokKalan > 0 ? _stokKalan : StokGiris - StokCikis;
            }
            set { _stokKalan = value; }
        }
        public decimal UretimGiris { get; set; }
        public decimal UretimCikis { get; set; }
        public decimal UretimKalan
        {
            get
            {
                return _uretimKalan > 0 ? _uretimKalan : UretimGiris - UretimCikis;
            }
            set { _uretimKalan = value; }
        }
        public decimal TransferGiris { get; set; }
        public decimal TransferCikis { get; set; }
        public decimal TransferKalan
        {
            get
            {
                return _transferKalan > 0 ? _transferKalan : TransferGiris - TransferCikis;
            }
            set { _transferKalan = value; }
        }
        public decimal SiparisAlis { get; set; }
        public decimal SiparisSatis { get; set; }
        public decimal SiparisKalan
        {
            get
            {
                return _siparisKalan > 0 ? _siparisKalan : SiparisAlis - SiparisSatis;
            }
            set { _siparisKalan = value; }
        }
        public decimal RezerveAlis { get; set; }
        public decimal RezerveSatis { get; set; }
        public decimal RezerveKalan
        {
            get
            {
                return _rezerveKalan > 0 ? _rezerveKalan : RezerveAlis - RezerveSatis;
            }
            set { _rezerveKalan = value; }
        }
        public decimal StokToplam
        {
            get
            {
                return _stokToplam > 0 ? _stokToplam : DevirGiris + KonsinyeKalan + IrsaliyeKalan + FaturaKalan + StokKalan + UretimKalan + TransferKalan + SiparisKalan + RezerveKalan;
            }
            set { _stokToplam = value; }
        }

    }

    #endregion

    #region

    public class StockXmlImport
    {
        public int KrtId { get; set; }
        public short XmlId { get; set; }
        public string XmlKartId { get; set; }
        public string XmlKartKod { get; set; }
        public string XmlKartBarkod { get; set; }
        public decimal Alisfiyati { get; set; }
        public DateTime DuzelTar { get; set; }
        public decimal StokMiktar { get; set; }
        public decimal StokMiktarYolda { get; set; }
        public bool Guncelle { get; set; }
        public string XmlVaryant { get; set; }
    }

    #endregion

    #region StockPrices

    public class StockPrices
    {
        public decimal AlisFiyati { get; set; }
        public decimal SatisFiyati { get; set; }
        public decimal AlisFiyatiDoviz { get; set; }
        public decimal SatisFiyatiDoviz { get; set; }
        public string AlisDovizCinsi { get; set; }
        public string SatisDovizCinsi { get; set; }
        public decimal BayiSatisFiyati { get; set; }
        public decimal MinSatisFiyati { get; set; }
        public decimal TedarikciFiyati { get; set; }
        public decimal StokFiyati { get; set; }
    }

    #endregion

    #region LinkedProduct

    public class LinkedProduct
    {
        public int Id { get; set; }
        public int KrtId { get; set; }
        public int LinkedId { get; set; }
        public short ListOrder { get; set; }
        public string ProductName { get; set; }
        public decimal Price { get; set; }
        public string LinkUrl { get; set; }
        public string ProductCode { get; set; }
        public int ProductImageCount { get; set; }
    }

    #endregion


}
